package p14.p1425;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {
    public static void main(String[] args) throws ParseException {
        //System.out.println("");
        Date date = new Date();
       // date.
        String year = "1995-02-24 12:12:12";
        String dateStr ="yyyy-MM-dd HH:mm:ss";
        SimpleDateFormat toDate = new SimpleDateFormat(dateStr);
        Date yearsDate = toDate.parse(year);
       long burTime =  yearsDate.getTime();
       long nowTime = System.currentTimeMillis();
       long getTime = date.getTime();
        System.out.println("出生 = " + burTime);
        //System.out.println("得到 = " + getTime);
        System.out.println("现在 = " + nowTime);

        long life = nowTime - burTime;
        System.out.println("life = " + life);
        System.out.println("life/1000/60/60/24/365 = " + life/1000/60/60/24/365);

    }
}
